package com.sqx.modules.userCertification.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.userCertification.entity.UserCertification;
import com.sqx.modules.userCertification.service.IUserCertificationService;
import com.sqx.modules.userCertification.vo.UserCertificationVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 实名认证表
 *
 * @author wuchang
 * @since 2023-07-25
 */
@RestController
@RequestMapping("/admin/userCertification/")
@Api(value = "实名认证表-管理端", tags = {"实名认证表-管理端"})
public class AdminUserCertificationController {
    @Autowired
    private IUserCertificationService certificationService;

    @ApiOperation("审核实名认证")
    @PostMapping("saveUserCertification")
    public Result examine(Long certificationId, Integer examineStatus, String examineDetails) {
        return certificationService.examine(certificationId, examineStatus, examineDetails);
    }

    @ApiOperation("获取实名认证列表")
    @GetMapping("getCertificationList")
    public Result getCertificationList(Integer page, Integer limit, UserCertificationVo userCertificationVo) {
        return Result.success().put("data", certificationService.getCertificationList(page, limit, userCertificationVo));
    }

    @ApiOperation("删除实名认证")
    @PostMapping("deleteCertification")
    public Result deleteCertification(Long certificationId) {
        return certificationService.deleteCertification(certificationId);
    }

    @ApiOperation("修改实名认证")
    @PostMapping("updateCertification")
    public Result updateCertification(UserCertification userCertification) {
        return certificationService.updateById(userCertification) ? Result.success() : Result.error();
    }

}
